<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="../jquery/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("button#button-replaceWith").click(function(){
		$("p").replaceWith("<strong>您好！您最喜欢的IT公司是：</Strong>");
		$("[name='name-replace']").replaceWith("<tr><td>name-replace</td><td>name-replace</td><td>name-replace</td><td>name-replace</td></tr><tr><td>name-replace</td><td>name-replace</td><td>name-replace</td><td>name-replace</td></tr>");
	});
});
</script>
<title>超实用的jQuery代码段</title>
</head>
<body>
<h2>超实用的jQuery代码段 - jQuery替换节点元素的方法</h2>
<p>您好！您最喜欢的IT公司是：</p>
<ul>
	<li title="Google">Google</li>
	<li title="Apple">Apple</li>
	<li title="Microsoft">Microsoft</li>
</ul>
<table name="name-replace"></table>
<button id="button-replaceWith">替换节点元素 - replaceWith方法</button>
</body>
</html>